package com.ouc.eddyAlgorithm.controller;

import com.ouc.eddyAlgorithm.domain.EddyFile;
import com.ouc.eddyAlgorithm.domain.OUCAjaxResult;
import com.ouc.eddyAlgorithm.domain.PageInfo;
import com.ouc.eddyAlgorithm.service.EddyFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * B504
 *
 * @author B504
 */
@RestController
@RequestMapping("eddyData")
public class EddyDataController {

  @Autowired
  private EddyFileService eddyFileService;

  //涡旋文件界面
//  @RequestMapping("eddyFileHtml")
//  public ModelAndView eddyFile() {
//    return new ModelAndView("eddy/dataAnalysis/dataFile");
//  }

  @RequestMapping("eddyFiles")
  public OUCAjaxResult findAll(@RequestParam("page") Integer page, @RequestParam("rows") Integer rows) {
    PageInfo<EddyFile> pageInfo = eddyFileService.findByPage(page, rows);
    System.out.println(pageInfo);
    return OUCAjaxResult.ok(pageInfo);
  }

  @RequestMapping("eddyFilesCondition")
  public OUCAjaxResult findAllCondition(@RequestParam("page") Integer page,
                                        @RequestParam("rows") Integer rows,
                                        @RequestParam("filename") String filename,
                                        @RequestParam("variableName") String variableName) {
    PageInfo<EddyFile> pageInfo = eddyFileService.findByPageByFilenameAndVariableName(page, rows, filename, variableName);
    System.out.println(pageInfo);
    return OUCAjaxResult.ok(pageInfo);
  }

}
